package DB.FileCommand;

import Command.AbstractCommand;
import Command.SetCommand;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.locks.Lock;

public class aof {


    BufferedWriter AofbufferedWriter = null;



    public aof(String logPath) {
        try {
            AofbufferedWriter = new BufferedWriter(new FileWriter(new File(logPath)));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //写入文件
    public void aofWrite(SetCommand setCommand) {

            try {
                AofbufferedWriter.write(setCommand.toString());
                System.out.println("aof");
                AofbufferedWriter.newLine();
                AofbufferedWriter.flush();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

     //关闭aof
    public void aofShutDown(){
        try {
            AofbufferedWriter.close();
        }catch (Exception e){
            e.printStackTrace();
        }

     }



    }



